<?php

namespace app\selladmin\controller;

use think\Controller;
use think\Log;
use think\db;

class CommonController extends Controller {
    const DEFAULTIMG_1='default/user3-128x128.jpg';

    public function _initialize() {
        //$this->action_log();//记录管理员的操作
        //$name = CONTROLLER_NAME;
        $session = session(config('adminconfig.USER_AUTH_KEY'));
        if (!isset($session)) {
            $this->redirect('selladmin/login/index');
        }

        /* $notAuth = in_array(MODULE_NAME, explode(',', C('NOT_AUTH_MODULE'))) || in_array(ACTION_NAME, explode(',', C('NOT_AUTH_ACTION'))) || C('RBAC_SUPERADMIN') == $_SESSION['username'];
          if (C('USER_AUTH_ON') && !$notAuth) {
          $Rbac = new \Org\Util\Rbac;
          $Rbac->AccessDecision($name) || $this->error('没有权限');
          } */
    }

    /*
     * 返回json
     */

    public function ajaxReturn($code, $msg, $data) {
        $array = [
            'code' => $code,
            'msg' => $msg,
            'data' => $data,
        ];

        return $array;
    }

}
